﻿using FastReport.Utils.Json.Serialization;
using FastReport;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 纺织贸易管理系统;

namespace Tools
{
    public class 打印客诉单
    {
        public string 客诉单号 { get; set; } = string.Empty;
        public string 业务员 { get; set; } = string.Empty;
        public DateTime 单据日期 { set; get; } = DateTime.Now;
        public DateTime 客诉日期 { set; get; } = DateTime.Now;
        public string 客诉类型 { set; get; } = string.Empty;
        public string 客商名称 { set; get; } = string.Empty;
        public string 异常描述 { set; get; } = string.Empty;
        public string 原因分析 { set; get; } = string.Empty;
        public string 处理方案 { set; get; } = string.Empty;
        public string 长期改善措施 { set; get; } = string.Empty;
        public decimal 客诉金额 { set; get; } = decimal.Zero;
        public string 接收人 { set; get; } = string.Empty;
        public string ReportPath {  set; get; } = string.Empty;
        public void 打印(PrintModel useful, 打印客诉单 doc, List<danjumingxitable> details)
        {
            var ds = new DataSet();
            ds.Tables.Add(JsonConverter.Deserialize<DataTable>(JsonConverter.Serialize(doc)));
            ds.Tables.Add(JsonConverter.Deserialize<DataTable>(JsonConverter.Serialize(details)));
            Report fs = new Report();
            fs.RegisterData(ds);
            PrintHelper.PrintReport(useful, ds, ReportPath + "销售客诉单.frx");
        }

    }
}
